#if TOOLS
using Godot;
using Godot.Collections;

[Tool]
public partial class VoxImportPlugin : EditorImportPlugin
{
    public override string _GetImporterName() => "zerax.voxmodel";
    public override string _GetVisibleName() => "Vox Model";
    public override string[] _GetRecognizedExtensions() => ["vox"];
    public override string _GetSaveExtension() => "tres";
    public override bool _GetOptionVisibility(string path, StringName optionName, Dictionary options) => false;
    public override Array<Dictionary> _GetImportOptions(string path, int presetIndex) => [];
    public override int _GetImportOrder() => 0;
    public override float _GetPriority() => 1.0f;
    public override string _GetResourceType() => "Resource";
    public override int _GetPresetCount() => 1;
    public override string _GetPresetName(int presetIndex) => "VoxModel";
    public override Error _Import(string sourceFile, string savePath, Dictionary options, Array<string> platformVariants, Array<string> genFiles)
    {
        var vox = VoxModel.Load(sourceFile);
        return ResourceSaver.Save(vox, $"{savePath}.{_GetSaveExtension()}");
    }
}
#endif